#pragma once
#include <memory>
#include <string>
#include "json.h"


class HomeScreen{
public:
    using  Ptr = std::shared_ptr<HomeScreen>;
    HomeScreen(const std::string& homeScreenImagePath, int homeScreenImageSize, 
        const std::string& backgroundImagePath, int backgroundImageSize, 
        const Json::Value& textInfo){
        m_homeScreenImagePath = homeScreenImagePath;
        m_homeScreenImageSize = homeScreenImageSize;
        m_text_info = textInfo;
        m_backgroundImagePath = backgroundImagePath;
        m_backgroundImageSize = backgroundImageSize;
    }

    const std::string& HomeScreenImagePath(){
        return m_homeScreenImagePath;
    }

    const std::string& BackgroundImagePath(){
        return m_backgroundImagePath;
    }

    int HomeScreenImageSize(){
        return m_homeScreenImageSize;
    }

    int BackgroundImageSize(){
        return m_backgroundImageSize;
    }

    const Json::Value& TextInfo(){
        return m_text_info;
    }

private:
    std::string m_homeScreenImagePath;
    int m_homeScreenImageSize;

    std::string m_backgroundImagePath;
    int m_backgroundImageSize;

    Json::Value m_text_info;
};

class HomeScreenManager{
public:
    using Ptr = std::shared_ptr<HomeScreenManager>;
    static Ptr Instance();
    HomeScreenManager();
    ~HomeScreenManager();

private:
    void registRPC();
    bool createHomeScreen(const Json::Value& req_params, Json::Value& res_result, 
            std::string& errinfo, int& errorCode);
    bool getHomeScreen(const Json::Value& req_params, Json::Value& res_result, 
            std::string& errinfo, int& errorCode);
    bool stopHomeScreen(const Json::Value& req_params, Json::Value& res_result, 
            std::string& errinfo, int& errorCode);
    HomeScreen::Ptr m_homeScreen;
    uint16_t m_index = 0;
};